package com.spring.graphql.resolver;

import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.spring.graphql.models.User;
import com.spring.graphql.repositories.UserRepository;

public class Query implements GraphQLQueryResolver {

    private UserRepository userRepository;

    public Query(UserRepository userRepository) {
        this.userRepository = userRepository;
    }

    public Iterable<User> findAllUser() {
        return userRepository.findAll();
    }

    public long countUser() {
        return userRepository.count();
    }
}
